Class symantec.itools.awt.KeyPressManagerPanel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.KeyPressManagerPanel

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----symantec.itools.awt.KeyPressManagerPanel

public class KeyPressManagerPanel
extends Panel
implements Serializable
A Panel extension which provides for tabbing between components and supporting certain key accelerations by posting events provided by the user. Can be used directly or extended. When extending be sure to super() during construction and to super.handleEvent(evt) from handleEvent if you override it.

The tab focus order is based on the order in which the components were added to the panel. Each component receives focus in turn, but the mouse cursor is not relocated. Look at the Project window to see the tab order of components within the KeyPressManagerPanel. You can change the tab order by moving the component names in the Project window list, or by adding them to the panel in a different order in your source code.

Components respond to default events when they receive focus. For example, the TextField component displays text input from the keyboard, and the Button component issues an action event when it is clicked.

Use KeyPressManagerPanel to create a panel whose elements can be tabbed through, and specifically to:

Version:
1.1, July 18, 1997
Author:
Symantec

Variable Index

 o action
Listens for an action and posts a default button action when triggered.
 o cancelButton
The button to press when the Escape key is pressed.
 o defaultButton
The button to press when the Enter/Return key is pressed.
 o key
Listens for an key and if appropriate posts a default or cancel button action.

Constructor Index

 o symantec.itools.awt.KeyPressManagerPanel()
Constructs a Panel which handles key press events.

Method Index

 o addImpl(Component, Object, int)
Inserts a component into this container at the given position, and adds it to the layout manager using the specified constraints object.
 o componentAdded(Component)
Sets the tab stop if necessary, hooks up any listeners we need.
 o componentRemoved(Component)
Utility routined automatically called before a component is removed from this panel.
 o consumeKeyTyped(KeyEvent)
Internally called utility routine that handles ENTER and ESCAPE key processing.
 o handleTabEvent(KeyEvent)
Internally called utility routine that handles TAB key processing.
 o remove(int)
Removes the component at the specified zero-relative index from this container.
 o removeAll()
Removes all the components from this container.
 o removeCancelButton()
Removes Escape key association with current Cancel button/event.
 o removeDefaultButton()
Removes Enter/Return key association with current default button/event.
 o resetKeyManager()
Resets all KeyPressManager associations (default button, cancel button, tab stop list).
 o sendAction(Button)
This helper method sends an action event to the specified button.
 o setCancelButton(Button)
Sets the button to press when the Escape key is pressed.
 o setCancelButton(Button, Event, Container, boolean)
 o setDefaultButton(Button)
Sets the button to press when the Enter or Return key is pressed.
 o setDefaultButton(Button, Event, Container, boolean)

Variables

 o action
protected symantec.itools.awt.KeyPressManagerPanel. A action
Listens for an action and posts a default button action when triggered.

 o cancelButton
protected java.awt.Button cancelButton
The button to press when the Escape key is pressed.

See Also:
setCancelButton
 o defaultButton
protected java.awt.Button defaultButton
The button to press when the Enter/Return key is pressed.

See Also:
setDefaultButton
 o key
protected symantec.itools.awt.KeyPressManagerPanel. K key
Listens for an key and if appropriate posts a default or cancel button action.

Constructors

 o KeyPressManagerPanel
public KeyPressManagerPanel()
Constructs a Panel which handles key press events. By default, components added to this panel can be tabbed to. To change this call method setAutoTabState() with false before adding components that can't be tabbed to.

Methods

 o addImpl
protected void addImpl(Component component,
                       Object constraints,
                       int index)
Inserts a component into this container at the given position, and adds it to the layout manager using the specified constraints object.

This is a standard Java AWT method which is overridden to track every add request to a container.

Parameters:
component - the component to add
constraints - the positioning constraints for the layout manager
index - the zero-relative index at which to add the component, or -1 to append to the end
Overrides:
addImpl in class Container
See Also:
remove
 o componentAdded
protected void componentAdded(Component component)
Sets the tab stop if necessary, hooks up any listeners we need. Called when any component is added to the panel

Parameters:
component - component being added to the panel.
See Also:
componentRemoved
 o componentRemoved
protected void componentRemoved(Component component)
Utility routined automatically called before a component is removed from this panel. It removes this panel's key event listeners and, for TextFields, action event listeners.

Parameters:
component - the component about to be removed from this panel
 o consumeKeyTyped
protected boolean consumeKeyTyped(KeyEvent evt)
Internally called utility routine that handles ENTER and ESCAPE key processing.

Parameters:
evt - the key event
Returns:
true if an action event was sent to the default button
 o handleTabEvent
protected boolean handleTabEvent(KeyEvent evt)
Internally called utility routine that handles TAB key processing.

Parameters:
evt - the key event
Returns:
true if an event was processed
 o remove
public void remove(int index)
Removes the component at the specified zero-relative index from this container.

This is a standard Java AWT method which gets called to remove a component from a container. When this happens the component's removeNotify() will also get called to indicate component removal.

Parameters:
index - the zero-relative index of the component to remove
Overrides:
remove in class Container
See Also:
removeAll, add
 o removeAll
public void removeAll()
Removes all the components from this container.

This is a standard Java AWT method which gets called to remove all the components from a container. When this happens each component's removeNotify() will also get called to indicate component removal.

Overrides:
removeAll in class Container
See Also:
remove, add
 o removeCancelButton
public void removeCancelButton()
Removes Escape key association with current Cancel button/event.

See Also:
setCancelButton
 o removeDefaultButton
public void removeDefaultButton()
Removes Enter/Return key association with current default button/event.

See Also:
setDefaultButton
 o resetKeyManager
public void resetKeyManager()
Resets all KeyPressManager associations (default button, cancel button, tab stop list).

 o sendAction
protected boolean sendAction(Button button)
This helper method sends an action event to the specified button.

 o setCancelButton
public void setCancelButton(Button button)
Sets the button to press when the Escape key is pressed.

Parameters:
button - the button to set as Cancel
See Also:
removeCancelButton
 o setCancelButton
public void setCancelButton(Button button,
                            Event evt,
                            Container deliverTo,
                            boolean bSetFocus)
Note: setCancelButton() is deprecated. CancelButton will be sent action and focus will be set.

See Also:
setCancelButton(java.awt.Button)
 o setDefaultButton
public void setDefaultButton(Button button)
Sets the button to press when the Enter or Return key is pressed.

Parameters:
button - the button to set as default
See Also:
removeDefaultButton
 o setDefaultButton
public void setDefaultButton(Button button,
                             Event evt,
                             Container deliverTo,
                             boolean bSetFocus)
Note: setDefaultButton() is deprecated. defaultButton will be sent action and focus will be set

See Also:
setDefaultButton(java.awt.Button)

All Packages  Class Hierarchy  This Package  Previous  Next  Index